/**
 * 公共的接口封装
 * 建议把每个请求都封装 一下
 */
import request from '@/utils/request'
export const login = (data) => request({
  method: 'post',
  url: '/login',
  data: { // 传递 post 参数
    username: data.username,
    password: data.password
  }
}).then(res => res.data)

export const upload = files => {
  const formData = new FormData()
  formData.append('file', files[0])
  return request({
    method: 'post',
    url: '/upload',
    data: formData
  }).then(res => res.data)
}
